package com.yida.gwj.expend.outside.domain.request;

import java.time.LocalDate;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import com.yida.common.core.exception.ServiceException;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * gwj保存改造方案请求
 *
 * @author wkz
 * @date 2023/03/01
 */
@ApiModel(description = "保存改造方案请求参数")
public class GwjSaveChangeSchemeRequest {

    private static final long serialVersionUID = 1L;
    /**
     * 业务id
     */
    @ApiModelProperty(value = "业务id")
    @NotNull(message = "业务id不能不能为空")
    private Long bizId;

    @ApiModelProperty("附件主键")
    private Long attachmentId;

    /**
     * 维修和更新、改造费用明细
     */
    @ApiModelProperty(value = "维修和更新、改造费用明细")
    private String costDetail;
    /**
     * 对公账号(duigongzhanghao)
     */
    @ApiModelProperty(value = "对公账号(duigongzhanghao)")
    private String corporateAccount;
    /**
     * 专有部分业主的户数及分摊额度
     */
    @ApiModelProperty(value = "专有部分业主的户数及分摊额度")
    private String updateDetail;

    /**
     * 保存时间
     */
    @ApiModelProperty(value = "保存时间")
    @NotEmpty(message = "保存时间不能不能为空")
    private LocalDate saveTime;

    public Long getAttachmentId() {
        return attachmentId;
    }

    public void setAttachmentId(Long attachmentId) {
        this.attachmentId = attachmentId;
    }

    public Long getBizId() {
        return bizId;
    }

    public void setBizId(Long bizId) {
        this.bizId = bizId;
    }

    public String getCostDetail() {
        return costDetail;
    }

    public void setCostDetail(String costDetail) {
        this.costDetail = costDetail;
    }

    public String getCorporateAccount() {
        return corporateAccount;
    }

    public void setCorporateAccount(String corporateAccount) {
        this.corporateAccount = corporateAccount;
    }

    public String getUpdateDetail() {
        return updateDetail;
    }

    public void setUpdateDetail(String updateDetail) {
        this.updateDetail = updateDetail;
    }

    public LocalDate getSaveTime() {
        return saveTime;
    }

    public void setSaveTime(LocalDate saveTime) {
        this.saveTime = saveTime;
    }

    @Override
    public String toString() {
        return "GwjSaveChangeSchemeRequest{" + "bizId=" + bizId + ", costDetail='" + costDetail + '\'' + ", corporateAccount='" + corporateAccount + '\'' + ", updateDetail='" + updateDetail + '\'' + ", saveTime=" + saveTime + '}';
    }

    public void checkNull() {
        if (ObjectUtil.isNull(costDetail)) {
            throw new ServiceException("维修和更新、改造费用明细costDetail不能为空");
        }
        if (ObjectUtil.isNull(corporateAccount)) {
            throw new ServiceException("对公账号corporateAccount不能为空");
        }
        if (StrUtil.isBlank(updateDetail)) {
            throw new ServiceException("专有部分业主的户数及分摊额度updateDetail不能为空");
        }
        if (ObjectUtil.isNull(saveTime)) {
            throw new ServiceException("保存时间saveTime不能为空");
        }
    }
}
